package com.pdd.service.impl;

import com.alibaba.fastjson.JSON;
import com.pdd.commons.enums.ResponseErrorEnum;
import com.pdd.commons.enums.ResponseSuccessEnum;
import com.pdd.commons.response.ResponseEntity;
import com.pdd.commons.response.ResponseResult;
import com.pdd.mapper.Gay_Pic_ContentMapper;
import com.pdd.model.dao.Gay_Pic_Content;
import com.pdd.service.Gay_Pic_ContentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author:liyangpeng
 * @date:2019/6/4 15:01
 */
@Service
public class Gay_Pic_ContentServiceImpl implements Gay_Pic_ContentService {

    private Logger logger= LoggerFactory.getLogger(Gay_Pic_ContentServiceImpl.class);

    @Autowired
    private Gay_Pic_ContentMapper gay_pic_contentMapper;

    @Override
    public ResponseEntity addPicContent(Gay_Pic_Content pic_content) {
        Integer addResult=gay_pic_contentMapper.addPicContent(pic_content);
        if(addResult!=null&&addResult>0){
            logger.info("【表情包-爬虫】添加图片内容成功:{}", JSON.toJSONString(pic_content));
            //添加成功
            return ResponseResult.RETURN_SUCCESS(ResponseSuccessEnum.ADD_PIC_CONTENT_SUCCESS);
        }
        logger.info("【表情包-爬虫】添加图片内容失败:{}", JSON.toJSONString(pic_content));
        //添加失败
        return ResponseResult.RETURN_ERROR(ResponseErrorEnum.ADD_PIC_CONTENT_ERROR);
    }
}
